package main

import (
	"fmt"
)

func main() {
	nums := []int{2, 3, 2, 3, 2, 3, 2}
	target := 3
	size := removeElement(nums, target)
	fmt.Println(size)
}

func removeElement(nums []int, val int) int {
	size := 0
	for i := 0; i < len(nums); i++ {
		if nums[i] != val {
			nums[size] = nums[i]
			size++
		}
	}
	return size
}
